function plotWeights(w,binSize)
% function to show the color weights, where each bar are shown in the color it represents
% currently, the color space is assumed to be in hsv color, 
% which are laied in the sequence of "h s v h s v", and each charactor means weights on a histogram of a color channel
figure;
hold on;

% H channel
width = 256/binSize(1);
half_width = width/2;
width = width;
half_width  = half_width;
for iBin = 1:binSize(1)
    Y = zeros(numel(w),1);
    Y(iBin:sum(binSize):end) = w(iBin:sum(binSize):end);
	bar(Y,'facecolor',hsv2rgb(([0 0 iBin*width-half_width])/256),'edgecolor','none');
end

% S channel
width = 256/binSize(2);
half_width = width/2;
width = width;
half_width  = half_width;
for iBin = 1:binSize(1)
    Y = zeros(numel(w),1);
    Y(iBin+binSize(1):sum(binSize):end) = w(iBin+binSize(1):sum(binSize):end);
	bar(Y,'facecolor',hsv2rgb([255 iBin*width-half_width 255]/256),'edgecolor','none');
end

% V channel
width = 256/binSize(2);
half_width = width/2;
width = width;
half_width  = half_width;
for iBin = 1:binSize(1)
    Y = zeros(numel(w),1);
    Y(iBin+binSize(1)+binSize(2):sum(binSize):end) = w(iBin+binSize(1)+binSize(2):sum(binSize):end);
	bar(Y,'facecolor',hsv2rgb([iBin*width-half_width 255 255]/256),'edgecolor','none');
end


xlim([0.5, length(w)+0.5])
end